/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef SPATIAL_DEVICE_INFO_H
#define SPATIAL_DEVICE_INFO_H

#include <string>
#include <unistd.h>

#include "nocopyable.h"
#include "parcel.h"

namespace OHOS {
namespace Msdp {
enum SpatialDeviceType : uint32_t {
    DEVICE_TYPE_UNKNOWN = 0x00,
    DEVICE_TYPE_WIFI_CAMERA = 0x08,
    DEVICE_TYPE_AUDIO = 0x0A,
    DEVICE_TYPE_PC = 0x0C,
    DEVICE_TYPE_PHONE = 0x0E,
    DEVICE_TYPE_PAD = 0x11,
    DEVICE_TYPE_WATCH = 0x6D,
    DEVICE_TYPE_CAR = 0x83,
    DEVICE_TYPE_TV = 0x9C,
};

class SpatialDeviceInfo : public Parcelable {
public:
    SpatialDeviceInfo() = default;
    explicit SpatialDeviceInfo(const std::string &deviceId,
        const std::string deviceName, const SpatialDeviceType &type);
    virtual ~SpatialDeviceInfo() = default;

    /**
     * @brief Obtains the name of the current device info.
     *
     * @return Returns the current device id.
     */
    inline const std::string &GetDeviceId() const
    {
        return deviceId_;
    }

    /**
     * @brief Obtains the name of the current device info.
     *
     * @return Returns the current device name.
     */
    inline const std::string &GetDeviceName() const
    {
        return deviceName_;
    }

    /**
     * @brief Obtains the id of the current process.
     *
     * @return Returns the current process id.
     */
    inline SpatialDeviceType GetDeviceType() const
    {
        return deviceTypeId_;
    }

    /**
     * @brief read this Sequenceable object from a Parcel.
     *
     * @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
     * @return Returns true if read successed; returns false otherwise.
     */
    bool ReadFromParcel(Parcel &parcel);

    /**
     * @brief Marshals this Sequenceable object into a Parcel.
     *
     * @param outParcel Indicates the Parcel object to which the Sequenceable object will be marshaled.
     */
    virtual bool Marshalling(Parcel &parcel) const override;

    /**
     * @brief Unmarshals this Sequenceable object from a Parcel.
     *
     * @param inParcel Indicates the Parcel object into which the Sequenceable object has been marshaled.
     */
    static SpatialDeviceInfo *Unmarshalling(Parcel &parcel);

private:
    std::string deviceId_;
    std::string deviceName_;
    SpatialDeviceType deviceTypeId_;
};
} // namespace Msdp
} // namespace OHOS
#endif // SPATIAL_DEVICE_INFO_H
